﻿@model List<ForumCategory>
@{
	ViewBag.Title = T("Forums");
}
<ul class="path">
    <li class="first">@ActionLinkLocalized("Main", "Index", "Home")</li>
	@*<li>@ActionLinkLocalized("Forums", "List", "Forums")</li>*@
</ul>
@if (!ViewData.GetDefault<bool>("ShowFirstSteps"))
{
	<div class="forumList">
		<h1>@ViewBag.Title</h1>
		<div class="options">
			<a rel="nofollow" href="@Url.Action("LatestAllTopics")">@Html.Img("~/images/iconrss.gif", "rss")</a>
		</div>
		@foreach (ForumCategory category in Model)
		{
			<h2>@category.Name</h2>
			<ul class="itemsHeader">
				<li class="name">@T("Forum")</li>
				<li class="topicCount">@T("Topics")</li>
				<li class="replies">@T("Posts")</li>
			</ul>
			<ul class="items">
			@foreach (Forum forum in category.Forums)
			{
				<li>
					<h3 class="name">
                        @if (forum.UnreadMessagesCount.HasValue)
                        {
                            if (forum.UnreadMessagesCount.Value > 0)
                            {
                                <img border="0" class="readIcon"
                                    src="@Url.Content("~/Content/templates/" + ViewBag.Template.Name + "/contents/topic_unread.gif")" 
                                    alt="@S("{0} unread messages", forum.UnreadMessagesCount.Value)" />
                            }
                            else
                            {
                                <img border="0" class="readIcon"
                                    src="@Url.Content("~/Content/templates/" + ViewBag.Template.Name + "/contents/topic_read.gif")" 
                                    alt="@S("No unread messages")" />
                            }
                        }
                        else
                        {
                            <img border="0" class="readIcon"
                                    src="@Url.Content("~/Content/templates/" + ViewBag.Template.Name + "/contents/topic_unread.gif")" 
                                    alt="" />
                        }
						@Html.ActionLink(forum.Name, "Detail", new { forum = forum.ShortName })
					</h3>
					<div class="topicCount">@forum.TopicCount <span class="label">@(forum.TopicCount != 1 ? T("threads") : T("thread"))</span></div>
					<div class="separator">/ </div>
					<div class="replies">@forum.MessagesCount  <span class="label">@(forum.MessagesCount != 1 ? T("posts") : T("post"))</span></div>
					<p class="description">@forum.Description</p>
				</li>
            }
			</ul>
        }
 		@if (Model.Count == 0)
        {
			<p>
				@T("No forums found.")
				<br />
				@ActionLinkLocalized("Create a forum", "Add")
			</p>
        }
	</div>
}
else
{
	<div class="first-steps">
		<h1>@T("Welcome to TeamsPortal!")</h1>
		<p><strong>@T("You've successfully setup your TeamsPortal site")</strong></p>
	</div>
}